package com.zb.Service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zb.Service.NoteService;
import com.zb.entity.Note;
import com.zb.mapper.NoteMapper;

@Component("NoteService")
public class NoteServiceImpl implements NoteService {
	@Autowired
	private NoteMapper noteMapper;

	public void saveNote(Note note) {
		noteMapper.saveNote(note);
	}

	public void delectNote(int id) {
		noteMapper.delectNote(id);
	}

	public void updateNote(Note note) {
		noteMapper.updateNote(note);
	}

	public List<Note> findNotePage(int index, int size, int userId) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("index", (index-1)*size);
		params.put("size", size);
		params.put("userId", userId);
		return noteMapper.findNotePage(params);
	}

	public List<Note> getNoteById(int index,int size,int uid) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("index", (index-1)*size);
		params.put("size", size);
		params.put("uid", uid);
		return noteMapper.getNoteById(params);
	}

	public int getcount(int uid) {
		// TODO Auto-generated method stub
		return noteMapper.getcount(uid);
	}

}